/*
 * @Author: haoshuai 2339654012@qq.com
 * @Date: 2025-03-03 14:44:44
 * @LastEditors: haoshuai 2339654012@qq.com
 * @LastEditTime: 2025-03-06 19:11:21
 * @FilePath: \北13屏蔽门上位机前端\src\store\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'
import Vuex from 'vuex'
import cloneDeep from 'lodash/cloneDeep'
import user from './modules/user'
import userInfo from './modules/userInfo'
import doorInfo from './modules/doorInfo'

Vue.use(Vuex)

export default new Vuex.Store({
	namespaced: true,
	state: {
		// 导航条, 布局风格, default(白色) / colorful(鲜艳)
		navbarLayoutType: 'colorful',
		// 侧边栏, 布局皮肤, default(白色) / dark(黑色)
		sidebarLayoutSkin: 'dark',
		// 侧边栏, 折叠状态
		sidebarFold: false,
		// 侧边栏, 菜单
		sidebarMenuList: [],
		sidebarMenuActiveName: '',
		// 内容, 是否需要刷新
		contentIsNeedRefresh: false,
		// 内容, 标签页(默认添加首页)
		contentTabs: [{
			...window.SITE_CONFIG['contentTabDefault'],
			'name': 'home',
			'title': 'home'
		}],
		contentTabsActiveName: 'home',
	},
	modules: {
		user,
		userInfo,
		doorInfo
	},
	mutations: {
		// 重置vuex本地储存状态
		resetStore(state) {
			Object.keys(state).forEach((key) => {
				state[key] = cloneDeep(window.SITE_CONFIG['storeState'][key])
			})
		}
	}
})
